package com.easy.easybanner.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.drawable.ColorDrawable;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

/**
 * Created by Sigthp-P-Department on 2018/4/26.
 */

public class IndicatorView extends View {
    private int color;
    private Paint paint;

    public IndicatorView(Context context) {
        this(context,null,0);
    }

    public IndicatorView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs,0);
    }

    public IndicatorView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        paint = new Paint();
        paint.setAntiAlias(true);
        paint.setColor(color);
        if(color!=0){
//            color.setBounds(0,0,getMeasuredWidth(),getMeasuredHeight());
//            drawable.draw(canvas);
            canvas.drawCircle(getWidth()/2,getHeight()/2,getWidth()/2, paint);
        }

    }

    public void setDrawable(int color) {
        this.color = color;
        invalidate();
    }
}
